load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@bazel_skylib//rules:write_file.bzl", "write_file")

genrule(
    name = "genhtml_version",
    outs = ["genhtml_version.txt"],
    cmd = "$(execpath //:genhtml) --version > $(execpath genhtml_version.txt)",
    cmd_bat = "$(execpath //:genhtml) --version > $(execpath genhtml_version.txt)",
    tools = ["//:genhtml"],
)

write_file(
    name = "golden_genhtml_version",
    out = "golden_genhtml_version.txt",
    content = [
        "genhtml: LCOV version 2.3.1-1",
        "",
    ],
)

diff_test(
    name = "genhtml_version_diff_test",
    file1 = ":genhtml_version.txt",
    file2 = ":golden_genhtml_version.txt",
)
